package obj.day2.Test;

/**
 * @author げっしょく
 * @date 2021/7/16
 */
public class Test01 {
    public static void main(String[] args) {
        eat1(new Cat());
       eat1(new Dog());
       eat1(new Pig());
       ;
    }
    public static void eat1(Amaill a){
        a.eat();
        if(a instanceof Cat){
            Cat b = (Cat) a;
            b.CatMouse();
        }else if(a instanceof Dog){
            Dog b = (Dog)a;
            b.DogCu();
        }else{
            Pig p =(Pig) a;
            p.sleep();
        }
    }
}
